package edu.cqie.smartfarm.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import edu.cqie.smartfarm.verify.anno.Phone;
import edu.cqie.smartfarm.verify.anno.Status;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author yyw
 * @since 2024-12-26
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("user")
@ApiModel(value="User对象", description="")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "人员唯一标识符，自增主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "登录账号，字符串类型，确保唯一性，用于用户登录验证，非空")
    private String username;

    @ApiModelProperty(value = "登录密码")
    private String password;

    @ApiModelProperty(value = "人员姓名，字符串类型，表示系统用户的全名，非空")
    private String name;

    @ApiModelProperty(value = "手机号，字符串类型，允许NULL，用于联系用户")
    @Phone
    private String phone;

    @ApiModelProperty(value = "状态，布尔值（0或1），1代表启用，0代表停用，默认为启用状态")
    @Status
    private Integer status;

    @ApiModelProperty(value = "创建时间，自动设置为记录创建的时间戳")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @ApiModelProperty(value = "更新时间，当记录被修改时自动更新为此时间戳")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updatedAt;


}
